﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Common;
using Common.Views;

namespace BusinessLogic
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IWCFUsers" in both code and config file together.
    [ServiceContract]
    public interface IWCFUsers
    {
        [OperationContract]
        void Register(User newUser);

        [OperationContract]
        Role GetRole(int roleId);
               
        [OperationContract]
        bool IsAuthenticationValid(string username, string password);

        [OperationContract]
        IEnumerable<Country> GetCountries();

        [OperationContract]
        void PlaceComment(Comment c);

        [OperationContract]
        void PlaceRating(Rating r);

        [OperationContract]
        IEnumerable<Order> GetUserOrders(string username);

        [OperationContract]
        void AddToCart(ShoppingCart cart);

        [OperationContract]
        void DeleteCart(int scID);

        [OperationContract]
        int GetNoOfItemsInShoppingCart(string username);

        [OperationContract]
        int GetProductIDInShoppingCart(int productID);

        [OperationContract]
        ShoppingCart GetShoppingCartByID(int id);

        [OperationContract]
        ShoppingCart ViewShoppingCart(string username);

        [OperationContract]
        IEnumerable<ShoppingCart> ListShoppingCart(string username);

        [OperationContract]
        void AddOrder(Order newOrder);

        [OperationContract]
        void AddOrderDetails(OrderDetail od);

        [OperationContract]
        IEnumerable<Menu> GetMainMenus(int roleId);

        [OperationContract]
        IQueryable<Role> GetUserRoles(string username);

        [OperationContract]
        IQueryable<OrderDetail> GetOrderDetails(Guid oID);

        [OperationContract]
        User GetUser(string username);

        [OperationContract]
        IQueryable<UserOrderDetailsView> GetOrderDetailsByOrderID(Guid oID);

        [OperationContract]
        bool DoesUsernameExist(string username);

        [OperationContract]
        bool DoesEmailExist(string email);

        
        [OperationContract]
        IEnumerable<RatingOption> GetRatingsOptions();

        [OperationContract]
        IEnumerable<ShoppingCartView> DisplayShoppingCart(string username);

        [OperationContract]
        void SubmitFault(UserFault uf);

        [OperationContract]
        IEnumerable<FaultDetailsView> GetFaultDetailsForUser(string username);

        [OperationContract]
        IEnumerable<FaultDetailsView> GetFaultDetailsForAdmin(string username);

        [OperationContract]
        UserFault GetFaultByID(int id);

        [OperationContract]
        IEnumerable<FaultDetailsView> GetFilteredFaultDetailsForUser(string username, string fromDate, string toDate, int productID);

        [OperationContract]
        IEnumerable<FaultDetailsView> GetFaultDetailsForPDF(string username, int ticketNo);

        [OperationContract]
        IQueryable<UserOrderDetailsView> GetOrderDetailsByOrderIDandProductID(Guid oID, int pID);

        [OperationContract]
        void UpdateFault(UserFault newUF);

        [OperationContract]
        IEnumerable<User> GetUsernames();
        
        [OperationContract]
        IEnumerable<FaultDetailsView> GetFaultByTokenNumber(int tn, string username);

        [OperationContract]
        IEnumerable<FaultDetailsView> FilterFaultsByDate();

        [OperationContract]
        IEnumerable<FaultDetailsView> FilterFaultsByDateForAdmin(string admin);

        [OperationContract]
        IEnumerable<FaultDetailsView> AdvancedFaultSearch(string username, int tokenNumber, string fromD, string toDate);

        [OperationContract]
        IEnumerable<FaultDetailsView> GetAllFaultsForThisProduct(int pID, string username);

        [OperationContract]
        IEnumerable<StatisticalReportView> GetTopRatedProducts();

        [OperationContract]
        IEnumerable<StatisticalReportView> GetMostPurchasedProduct();

        [OperationContract]
        IEnumerable<StatisticalReportView> GetProductWithHighestNumberOfFaults();

        [OperationContract]
        IEnumerable<StatisticalReportView> GetProductWithLeastNumberOfFaults();

        [OperationContract]
        IEnumerable<UserOrderDetailsView> GetOrderDetailsFromFaultNO(int tn);

        [OperationContract]
        UserFault GetFaultsFirstDateByTokenNumber(int tn);
    }
}
